# import time
# from selenium import webdriver
# driver=webdriver.Chrome()
# driver.get("http://localhost/Home/user/reg.html")
# driver.find_element_by_id("username").send_keys("15837321720")
# driver.find_element_by_name("verify_code").send_keys("8888")
# driver.find_element_by_name("password").send_keys("123456")
# driver.find_element_by_name("password2").send_keys("123456")
# driver.find_element_by_name("invite").send_keys("12345678909")
# driver.find_element_by_class_name("J_btn_agree").click()
# list1 = driver.find_elements_by_class_name("inp")
# print(list1)
# time.sleep(5)
# driver.quit()
import time
from selenium import webdriver
#要求使用元素定位另外一种写法：driver.find_element(By.XXX,value)
from selenium.webdriver.common.by import By
driver=webdriver.Chrome()
driver.get("http://localhost/")
#1.使用xpath的文本形式定位tpshop首页注册超链接，并点击
driver.find_element(By.XPATH,"//*[text()='注册']").click()
#2.使用css属性定位策略定位手机号码输入框，输入手机号码
driver.find_element(By.CSS_SELECTOR,"[class='liner']>[class='inp fmobile J_cellphone']").send_keys("15837321720")
#3.使用css属性包含的方式定位验证码输入框，输入验证码
driver.find_element(By.CSS_SELECTOR,"[class='liner']>[class='inp imgcode J_imgcode']").send_keys("8888")
#4.使用xpath属性与逻辑结合定位方式定位密码输入框，输入设置密码
driver.find_element(By.XPATH,"//div[@class='liner']/input[@name='password']").send_keys("123456")
#5.使用xpath路径定位策略定位确认密码，输入确认密码
driver.find_element(By.XPATH,"//div[@class='liner']/input[@name='password2']").send_keys("123456")
#6.使用超链接定位方式定位同意协议并注册按钮，并点击
driver.find_element(By.LINK_TEXT,"同意协议并注册").click()
time.sleep(3)
driver.quit()